<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
//header('Access-Control-Allow-Origin:*');

class BaseController extends Controller
{

    protected $request;

    public function __construct(Request $request)
    {
        $this->request = $request->toArray();
    }



    /**
     * 发送json数据 php artisan make:controller /Api/Client/UserInifController --invokable
     * @param $data
     * @param string $msg
     * @param string $code
     * @return false|string
     */
    public function sendJson($data,$msg = 'success',$code = '200000'){
        return json_encode([
            'data' => $data,
            'msg' => $msg,
            'code' => $code
        ]);
    }
}
